Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebExtension (Firefox) compatibility for chromeIPass #595

Closed
wants to merge 21 commits into from
Closed

WebExtension (Firefox) compatibility for chromeIPass #595

wants to merge 21 commits into from

Conversation

projectgus
Copy link

@projectgus projectgus commented Feb 16, 2017

As discussed in #563. Allows Electrolysis (multi-process windows) feature to function in recent Firefox, and also provides a path for support once XUL-based addons are disabled in Firefox.

Support is not quite as tightly integrated as it was with passifox (ie there's no integration to Firefox's own "Fill Password" functions any more), but it seems very usable all the same.

Still a work in progress:

  • Changed all chrome.xxx APIs to use browser.. Some chrome APIs are implementated in Firefox and work as-is, but a few (such as chrome.extension.sendMessage() are not. Seemed cleaner to change them all over.
  • Add Mozilla's webextension-polyfill for Chrome compatibility for browser.xxx. Needed to cherry-pick some PRs before things came good (details in commit message). The basics seem to work.
  • Thoroughly test for broken Chrome functionality. I suspect there will still be some things which don't work.
  • Firefox doesn't support webRequest.onAuthRequired (yet?) so can't fill HTTP auth popups from Chromeipass. Need to at least re-enable for Chrome, and hide the relevant Settings on Firefox.
  • Haven't confirmed extension persistent storage (association to keypass, etc.) is working properly in FF. I think this is because I can only load the extension temporarily, so it's removing localStorage whenever I restart the browser. Firefox production builds don't allow unsigned addons at all any more, except temporarily.
  • Has a Chrome Web Store link in the Settings when running on Firefox
  • jQuery ("cIPJQ") seems to have some issues on FF that may be breaking functionality.
  • Detecting password fields for generation of new passwords doesn't yet work on FF, I think related to the jQuery errors but I'm not sure.
  • Context menu access keys aren't supported (and the strings render verbatim) in FF. FF Bug.

Also, I don't know if this would be a good time to change the name? Or even if you're interested in adding this support at all - given it's a fairly major change to what seems like a stable Chrome extension.

@pfn
Copy link
Owner

pfn commented Feb 16, 2017 via email

@projectgus
Copy link
Author

Thanks @pfn :)

I'm hoping to work on it in bits and pieces over the next little while. My day job is embedded development so playing with Javascript again is a breath of fresh air.

At the same time, if anyone else is reading this and wants to jump in and tackle any of the items mentioned above, please be my guest.

chrome-extension:// doesn't seem to have a static equivalent, so find at runtime
using .getURL() and build a style tag. Bit ickier. :/
Firefox doesn't allow clipboard copy on the background tab.

Verified still working in Chromium.
@projectgus projectgus changed the title WIP: WebExtension (Firefox) compatbility for chromeIPass WIP: WebExtension (Firefox) compatibility for chromeIPass Feb 19, 2017
…n Firefox

Uses the cross-browser webextensions API for onAuthRequested, so it may also
work in Opera or Edge(?), and could start working some day in Firefox if Mozilla adds
support.
@projectgus
Copy link
Author

Coming along pretty well.

Decided I may not need to fix the jQuery errors I'm seeing in FF console, they don't appear to have any bearing on behaviour.

@RlndVt
Copy link

RlndVt commented Mar 7, 2017

Could I help you with some testing? Don't have much experience with browser extensions but willing to try/learn.

@projectgus
Copy link
Author

Could I help you with some testing? Don't have much experience with browser extensions but willing to try/learn.

Sure, that'd be great! To install a development version in Firefox:

Usual caveats about development versions, trusting with your data, etc. apply. :)

As the addon is unsigned, it will uninstall when Firefox exits and you'll need to reload it. So far I've needed to re-pair it with KeepassXC each time this happens (there are some options in about:config, "extensions.webextensions.keepStorageOnUninstall" and "extensions.webextensions.keepUuidOnUninstall" but this has not been enough to make the association persist.) Still haven't looked to see if this is a bug in the addon or a security limitation of Firefox that can possibly be bypassed another way.

My current status on this is that I started yak shaving by adding support for context menu accelerator keys to firefox WebExtensions.

If you want to dig deeper, the Mozilla docs for WebExtensions are good: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/

@RlndVt
Copy link

RlndVt commented Mar 10, 2017

So far works great.

Have so far only noticed the bug you are working on atm, which seems to be a FF issue. I feel like your patch is ready to be pulled, while the compatibility is added to FF. Or would you rather wait till you have that fixed too?

Remaining bugs (bullet 3) will be found when more people start using this and start reporting them, and 5 should be fixed when this gets signed...

@craftycorvid
Copy link

craftycorvid commented Mar 15, 2017

I signed a version for testing, if anyone wants to give this a go. Just drag and drop the xpi into your Firefox window, should install and persist across sessions.

chromeipass-2.8.0-an+fx.xpi.zip

I can confirm that number 5 is done when using this signed and packaged addon.

@projectgus
Copy link
Author

I can confirm that number 5 is done when using this signed and packaged addon.

Excellent, thank you!

I feel like your patch is ready to be pulled, while the compatibility is added to FF.

I think I generally agree. There's only bug I've seen now, sometimes if you click "Fill User & Pass" in the contextual menu then a debugging window pops up due to a fatal error. Doesn't seem to happen every time.

Other than this, the contextual menu titles look a bit weird in Firefox but it's easy enough to open a separate issue to track this, until Firefox supports them.

Angus

@Taijian
Copy link

Taijian commented Mar 27, 2017

Works fine for me on FF 52.0.1 with GNOME on kernel 4.10.5.

The only issue I see is that Google's login (split over two pages) does not auto-fill on the first page, i.e. I have to manually add in my user name, then on the second page I have to manually click 're-scan credentials fields' for it to work.

@pfn
Copy link
Owner

pfn commented Mar 28, 2017 via email

@craftycorvid
Copy link

@pfn What work is still needed to get this PR merged?

@projectgus
Copy link
Author

@Ivan0xFF From my point of view I'd be happy for this to be merged now, and I'll open an issue to track the contextual menu thing.

If it stays open for a few more days then over the weekend I was hoping to try and track down the occasional error I was getting when selecting "Fill User & Pass". Although it seems like it may require some special combination of events to reproduce, as I've only seen it once or twice. So I don't think it's a showstopper.

In the end it's all up to @pfn as maintainer, of course. :)

@projectgus projectgus changed the title WIP: WebExtension (Firefox) compatibility for chromeIPass WebExtension (Firefox) compatibility for chromeIPass Mar 29, 2017
@projectgus
Copy link
Author

(I've checked "test for broken Chrome functionality" off my list as I've put Chromium through its major paces with this PR. I think if there are more subtle bugs they'll only be found once a larger number of users start using it, unfortunately.)

@pfn
Copy link
Owner

pfn commented Apr 17, 2017 via email

@yan12125
Copy link

I just tried @Ivan0xFF's version. It works with all of my daily sites. Awesome!

Just noticed that there are quite a few errors like this in the terminal:

JavaScript error: jar:file:///home/yen/.mozilla/firefox/468widst.default/extensions/%7B5affb487-fdda-435f-b4b8-2bfdba33e51f%7D.xpi!/chromeipass.js, line 1142: TypeError: cip.init is not a function

Is it harmless or a potential sign for a bug?

@yan12125
Copy link

yan12125 commented May 3, 2017

There's another issue: in the legacy Firefox addon, there's usually only one KeepassHTTP confirmation dialog for an password field. With this version, a KeepassHTTP confirmation dialog jumps out whenever a web page loses focus and gets focus again. This is somewhat annoying.

@projectgus
Copy link
Author

@smorks @pfn Is it helpful if I merge your changes into this PR branch as well? They seem great.

I'm not sure what the path forward from here is, exactly.

@projectgus
Copy link
Author

Some pages use a div that's hidden until you press a login button. This means the browser extension ignores those forms until they are visible. Currently there's no feature for redetecting the form fields automatically/continously.

@varjolintu I only use Chromium a little bit, but from what I recall it seems like this is an issue there as well? Or is it only an issue when running the WebExtension on Firefox?

@smorks
Copy link

smorks commented Sep 1, 2017

@projectgus i'm fine with merging my changes into this PR, not sure if it will help with moving things along at all.

@projectgus
Copy link
Author

projectgus commented Sep 1, 2017

Cool. Well, this PR branch is now level with your 2.8.5 release tag. I left out the most recent commit which changes README URLs, as if this PR is to be merged then we don't want that.

The other change which we may not want here is the new addon id. But I'm not going to bother changing it back until we know what @pfn plans to do.

(BTW, @smorks, I think the idea of you taking over as maintainer provided this works for @pfn.)

@varjolintu
Copy link

varjolintu commented Sep 1, 2017

@projectgus It happens with both browsers. I have an idea how to solve it but haven't tested it yet. Basically you could monitor any hidden divs that contain forms and do a re-detect when any of those hidden div's are visible again.

@smorks & @projectgus I really like these changes you've been making. If it's ok to you I would like to merge some of those to keepassxc-browser (and give you a credit of course).

@projectgus
Copy link
Author

@varjolintu If it's not Firefox-specific then probably best to open a separate issue to discuss it. I agree it would be nice to fix if possible (I do a lot of clicking on the chromeipass icon and saying "Redetect credential fields").

Regarding merging my changes, I have no problems with them being merged anywhere they are useful.

@smorks
Copy link

smorks commented Sep 1, 2017

@varjolintu i'm fine with you merging my changes too.

@ArjonBu
Copy link

ArjonBu commented Sep 2, 2017

Will this ever get merged?

@varjolintu
Copy link

I made a PR to projectgus/passifox#1 which solves an issue with HTTP auth with Chromium based browsers. It's not pretty but works as a workaround until there's a better solution.

@varjolintu
Copy link

varjolintu commented Sep 8, 2017

@smorks Here's one solution to the problem with forms inside hidden divs. Simple but works. Tested with Firefox 55 and Chromium 61. If you know any better solution than setInterval, please let me know.

@projectgus
Copy link
Author

projectgus commented Sep 8, 2017

Hmm. How about using MutationObserver to detect DOM changes? https://stackoverflow.com/a/11546242

May still need a timer to rate limit and avoid a notable performance impact (ie reset a ~100ms timer each time the DOM changes, so 100ms after the last DOM change event the extension scans for login boxes.)

EDIT: Actually, given you can filter the events you care about it may be possible to filter so you only get an event if a password field changes. I don't know if that would include the parent div's visibility changing, though.

BTW, @varjolintu, sorry I haven't looked at your other PR content yet. Plan to do so this weekend.

@varjolintu
Copy link

@projectgus I already closed the pull request. @smorks did a better job implementing the same fix :)

@hackel
Copy link

hackel commented Sep 22, 2017

The recent release of Firefox 57.0b1 makes the WebExtension-compatible version of Passifox all that much more urgent! Thanks for your continued work on this.

Edit: Just signed and installed it myself and it is working great!

@aurelg
Copy link

aurelg commented Sep 27, 2017

@hackel For those of us not familiar with signing/installing manually, would you mind providing a short description of the required steps, or at least a link?

@craftycorvid
Copy link

Track this project for a WebExtension fork of passifox/chromeipass: https://github.com/smorks/keepasshttp-connector

@craftycorvid
Copy link

And now it's on AMO: https://addons.mozilla.org/en-US/firefox/addon/keepasshttp-connector/

@z3ntu
Copy link

z3ntu commented Sep 28, 2017

Will passifox (on AMO) be updated to webextension in the future? Or will this "kepasshttp-connector" be the version to use on 57+?

@RealOrangeOne
Copy link

Firefox 57 has now been released, are there any plans to get this shipped soon? :shipit:

@dakra
Copy link

dakra commented Nov 15, 2017

@RealOrangeOne Loot at the comment above from @Ivan0xFF. The firefox compatible fork is already on AMO: https://addons.mozilla.org/en-US/firefox/addon/keepasshttp-connector/

I'm using it every day and works great :)

@Ketrel
Copy link

Ketrel commented Nov 15, 2017 via email

@RealOrangeOne
Copy link

The fork works, but its the chrome version, which doesnt integrate nicely with the builtin password manager. Really hope that feature stays, assuming the WebExtension API exposes this

@rugk
Copy link

rugk commented Nov 15, 2017

No that feature does not work. It is not yet exposed by the WebExtensions API.

@arpost1
Copy link

arpost1 commented Nov 28, 2017

Is the KeePassHTTP Connector add-on safe for users to use? I'm new to KeePass and am hoping that some kind of fix for Firefox Quantum integration that is secure is available.

@varjolintu
Copy link

@esat7 It is safe.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.